//
//  UIBarButton_Extension.swift
//  textweibo
//
//  Created by 李 付涛 on 2017/3/18.
//  Copyright © 2017年 江苏岳创信息科技有限公司. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    
    convenience init(title:String,action: Selector,target: Any?, isBack: Bool = false) {
        
        let btn:UIButton = UIButton.cz_textButton(title, fontSize: 16, normalColor: UIColor.darkGray, highlightedColor: UIColor.orange)
        if isBack {
            
            let imageName = "navigationbar_back_withtext"
            btn.setImage(UIImage(named: imageName), for: UIControlState(rawValue:0))
            btn.setImage(UIImage(named: imageName + "_highlighted"), for: .highlighted)
        }
        //btn.set
        btn.sizeToFit()
        btn.addTarget(target, action: action, for:.touchUpInside)
        
        self.init(customView: btn)
    }
    
    
    
}
